]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Do not duplicate app favorites
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 20 Jan 2021 00:44:21 +0000 (01:44 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 21 Jan 2021 17:17:47 +0000 (17:17 +0000)
With the new position, the dash is now stronger connected to the
app grid than it used to; reflect that by showing apps either
in the grid or the dash, not both (except for non-favorite
running apps).

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/88

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1580>

js/ui/appDisplay.js

index a2c6adaa04240532d8ef355fb6e9614829ea177c..a80fb773bec2d78eeaf050be08718b8c47acf554 100644 (file)
@@ -218,6 +218,11 @@ var BaseAppView = GObject.registerClass({
                 this._redisplay();
             });
 
+        // Don't duplicate favorites
+        this._appFavorites = AppFavorites.getAppFavorites();
+        this._appFavoritesChangedId =
+            this._appFavorites.connect('changed', () => this._redisplay());
+
         // Drag n' Drop
         this._lastOvershoot = -1;
         this._lastOvershootTimeoutId = 0;
@@ -236,6 +241,11 @@ var BaseAppView = GObject.registerClass({
             this._appFilterChangedId = 0;
         }
 
+        if (this._appFavoritesChangedId > 0) {
+            this._appFavorites.disconnect(this._appFavoritesChangedId);
+            this._appFavoritesChangedId = 0;
+        }
+
         if (this._swipeTracker) {
             this._swipeTracker.destroy();
             delete this._swipeTracker;
@@ -1138,7 +1148,8 @@ class AppDisplay extends BaseAppView {
             } catch (e) {
                 return false;
             }
-            return this._parentalControlsManager.shouldShowApp(appInfo);
+            return !this._appFavorites.isFavorite(appInfo.get_id()) &&
+                this._parentalControlsManager.shouldShowApp(appInfo);
         });
 
         let apps = this._appInfoList.map(app => app.get_id());
@@ -1757,6 +1768,9 @@ class FolderView extends BaseAppView {
             if (excludedApps.includes(appId))
                 return;
 
+            if (this._appFavorites.isFavorite(appId))
+                return;
+
             const app = appSys.lookup_app(appId);
             if (!app)
                 return;